# -*- codeing = utf-8 -*-
# @Time :2022/11/23 16:49
# @Author:xunyeren
import requests
import json


class RequestHelper(object):
    def __init__(self,host,headers:dict):
        self.host= host
        self.headers= headers

    def get_request(self, address: str,):
        url =self.host + address
        resp = requests.get(url, headers=self.headers)
        resp.close()
        return resp
    def post_request(self,address,data):
        url = self.host + address
        resp = requests.post(url=url,headers=self.headers,json=data)
        resp.close()
        return resp




if __name__ == '__main__':

    tokenId = "376fa423b4ab9dfbf27a5a2450d48075"
    host = "http://172.24.24.24:6001"
    url = "/bgt-config-service/v2/query/queryTreeAssistData"
    headers = {}
    headers["Tokenid"] = tokenId
    data = {"eleCode": "mof_div"}

    request_helper = RequestHelper(host,headers)
    resp = request_helper.post_request(url,data)
    res = resp.json()["data"]
    print(res)



